package com.mangowang.module.main.adapter;

import android.content.Context;
import android.graphics.Color;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.module.LoadMoreModule;
import com.chad.library.adapter.base.viewholder.BaseViewHolder;
import com.mangowang.lib.common.help.GlideHelper;
import com.mangowang.lib.common.proto.Mystock;
import com.mangowang.module.main.R;
import com.ruffian.library.widget.RTextView;

import java.util.List;

public class ChuRuAdapter extends BaseQuickAdapter<Mystock.allocationLogList.List, BaseViewHolder> implements LoadMoreModule {

    public ChuRuAdapter(Context context, List<Mystock.allocationLogList.List> dataList) {
        super(R.layout.item_chu_ru, dataList);
    }

    @Override
    protected void convert(BaseViewHolder helper, Mystock.allocationLogList.List item) {
        // 先判断是否是回拨还是调拨
        RTextView typeView = helper.getView(R.id.tv_type);
        if (item.getType().equals("1"))  // 划入
        {
            typeView.setText("划拨出库");
            typeView.getHelper().setBackgroundColorNormal(Color.parseColor("#FFE8EFFA"));
            typeView.setTextColor(Color.parseColor("#FF4863F0"));
            helper.setText(R.id.tv_name,  "划拨给: " + item.getRecipientName() + " "+item.getRecipientMobile());
        } else {
            typeView.setText("划拨入库");
            typeView.getHelper().setBackgroundColorNormal(Color.parseColor("#FFFEE9D4"));
            typeView.setTextColor(Color.parseColor("#FFFB9028"));
            helper.setText(R.id.tv_name,  "收到: " + item.getRecipientName() + " "+item.getRecipientMobile());
        }
        helper.setText(R.id.tv_goods_name, item.getEquipment() )
                .setText(R.id.tv_time, item.getEquipmentTime())
                .setText(R.id.tv_number,item.getEquipmentNum()+"台");
    }
}
